package htby.utils;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import app.monitor.bean.SystemBean;

public class IOTSUtils {

	/** kafka系统信息topic */
	public static String SYSTEM_INFO_TOPIC = "SYSTEM_INFO_TOPIC";
	/** kafka的ip */
	public static String KAFKA_SERVER_IP;
	/** kafka的port */
	public static String KAFKA_SERVER_PORT;
	/** Timer延迟时间 delay:延迟 */
	public static int MONITOR_TIMER_DELAY_TIME;
	/** Timer间隔时间 interval间隔 */
	public static int MONITOR_TIMER_INTERVAL_TIME;
	/** 系统属性 */
	public static SystemBean sysBean = new SystemBean();
	
	static {
		// 得到配置文件的数据，赋值到全局变量
		Properties prop = new Properties();
		InputStream in = Object.class.getResourceAsStream("/config.properties");
		try {
			prop.load(in);
		} catch (IOException e) {
			e.printStackTrace();
		}
		KAFKA_SERVER_IP = prop.getProperty("KAFKA_SERVER_IP");
		KAFKA_SERVER_PORT = prop.getProperty("KAFKA_SERVER_PORT");
		MONITOR_TIMER_DELAY_TIME = Integer.parseInt(prop.getProperty("MONITOR_TIMER_DELAY_TIME"));
		MONITOR_TIMER_INTERVAL_TIME = Integer.parseInt(prop.getProperty("MONITOR_TIMER_INTERVAL_TIME"));
	}

}
